<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false"%>
<html>
<head>
    <title>编辑结算区域</title>
</head>
<body>
<div ng-app="SettlementRegionUpdateApp" ng-controller="SettlementRegionUpdateCtrl">
    <ui-form key="SettlementRegionUpdate" column="2">
        <input name="id" type="hidden" value="${settlementRegion.id}"/>
        
        <ui-form-input name="name" label="别名" value="${settlementRegion.name}"></ui-form-input>

        <ui-form-select name="level" label="区域类型" value="${settlementRegion.level}">
            <%--0一类区域 1二类区域 2三类区域--%>
            <option value="0">一类区域</option>
            <option value="1">二类区域</option>
            <option value="2">三类区域</option>
        </ui-form-select>


        <ui-form-region label="目的地" p-name="toProvince" c-name="toCity" a-name="toCounty" value="${settlementRegion.toRegion.code }"></ui-form-region>


    </ui-form>
</div>
<script>
    angular.module('SettlementRegionUpdateApp', ['ui.form']);
    angular.module('SettlementRegionUpdateApp').controller('SettlementRegionUpdateCtrl', function ($scope) {
        $scope.$on('ui.form.submit',function (event,param) {
            $.ajax({
                url:"rule/settlementregion/update",
                type:"post",
                data:param
            }).done(function (result) {
                if(result.code=='0000'){
                    toastr.success("更新成功");
                    setTimeout(function () {
                        window.close();
                    },1500);                }else{
                    toastr.error(result.msg);
                }
            }).fail(function (err) {

            });
        })
    });
</script>
</body>
</html>